<!DOCTYPE html>
<html lang="en">
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>添加博客</title>
    <!-- 引入 layui.css -->
    <link rel="stylesheet" href="../layui/css/layui.css">
    <link rel="stylesheet" href="../css/add-log.css">
<!--    <link rel="stylesheet" href="../css/main.css">-->
    <link rel="stylesheet" href="../css/head.css">
    <script type="text/javascript" src="../layui/layui.js"></script>
    <link rel="stylesheet" href="../lib/editor/css/editormd.min.css">


</head>
<body bgcolor="#d2d2d2">
<!--    导航条-->
<div th:replace="~{head :: navigation-bar}"></div>
<!--        表单-->
<div class="main-content">
    <form class="layui-form" th:action="@{/addBlog}"> <!-- 提示：如果你不想用form，你可以换成div等任何一个普通元素 -->
        <div class="layui-form-item">
            <label class="layui-form-label">标题：</label>
            <div class="layui-input-block">
                <input type="text" name="title" placeholder="博文标题" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">博文简介：</label>
            <div class="layui-input-block"  id="synopsis">
                <textarea placeholder="请输入简介" class="layui-textarea" name="synopsis"></textarea>
            </div>
        </div>
        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">博文：</label>
            <div class="layui-input-block"  id="editor">
                <textarea placeholder="请输入内容" class="layui-textarea" name="content"></textarea>
            </div>
        </div>
        <div class="layui-form-item blog-type" >
            <label class="layui-form-label">博文分类：</label>
            <div class="layui-input-block">
                <select name="typeId" lay-filter="aihao">
                    <option value="0">前端</option>
                    <option value="1">后端</option>
                    <option value="2">UI</option>
                    <option value="3">测试</option>
                    <option value="4">DBA</option>
                </select>
            </div>
        </div>
        <div>
            <input type="hidden" name="userId" th:value="${userId}">
        </div>

        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn" lay-submit lay-filter="*" id="submit-blog" >立即提交</button>
                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            </div>
        </div>
        <!-- 更多表单结构排版请移步文档左侧【页面元素-表单】一项阅览 -->
    </form>
</div>

<script src="layui.js"></script>
<script>
    layui.use('form', function(){
        var form = layui.form;

        //各种基于事件的操作，下面会有进一步介绍
    });
</script>

<script src="https://cdn.jsdelivr.net/npm/jquery@3.2.1/dist/jquery.min.js"></script>
<script src="../lib/editor/editormd.min.js"></script>
<script>

    // md集成
    var contentEditor;
    $(function() {
        contentEditor = editormd("editor", {
            width   : "100%",
            height  : 640,
            syncScrolling : "single",
            path    : "../lib/editor/lib/"
        });
    });
</script>
</body>
</html>